package alipay.openplatform.edu.campus.jiuye.service.dao;


import java.io.Serializable;

/**
 * 接口返回值
 * <p>
 * author: 宗占杰[zongzhanjie@qudian.com]
 * date: 16/8/24
 * since: 1.0
 */
public class ApiResult implements Serializable{

    private static final long serialVersionUID = -236053672816307102L;

    /**
     * 返回code
     */
    private String code;


    /**
     * 返回信息
     */
    private String message;
    /**
     * 返回数据
     */
    private Object datas;

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public Object getDatas() {
        return datas;
    }

    public void setDatas(Object datas) {
        this.datas = datas;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }


    public static ApiResult build(String code, String msg) {
        ApiResult apiResult = new ApiResult();
        apiResult.setCode(code);
        apiResult.setMessage(msg);
        return apiResult;
    }

    public static ApiResult buildSuccess(String code, String msg, Object datas) {
        ApiResult apiResult = new ApiResult();
        apiResult.setCode(code);
        apiResult.setMessage(msg);
        apiResult.setDatas(datas);
        return apiResult;

    }


    @Override
    public String toString() {
        return "ApiResult{" +
                "code='" + code + '\'' +
                ", message='" + message + '\'' +
                ", datas=" + datas +
                '}';
    }


}